#include <stdlib.h>
#include <string>
#include <string.h>
#include <iostream>
#include "Operations/Operation.h"
using namespace std;


Operation* createOperation(int argc, char *argv[]){
	Operation* op;
	if (!strcmp(argv[1],"cs")) {
		//			type = CS;
		//			opOrder = 2;
		//			sprintf(opName, "MIRROR SYMMETRY");
	} else if (!strcmp(argv[1], "ci")) {
		//			type = CI;
		//			opOrder = 2;
		//			sprintf(opName, "INVERSION (S2)");
	} else if (!strcmp(argv[1], "ch")) {
		//			type = CH;
		//			opOrder = 2;
		//			sprintf(opName, "CHIRALITY");
	} else if (argv[1][0] == 'c') {
		op = new C_Operation(argc, argv);
	} else if (argv[1][0] == 's') {
		//			type = SN;
		//			opOrder = atoi(argv[1] + 1);
		//			if (opOrder % 2 != 0) {
		//				printf("ERROR - Only Even values of n are allowed\n");
		//				exit(1);
		//			}
		//			sprintf(opName, "S%d SYMMETRY",opOrder);
	}
	return op;
}


int main(int argc, char *argv[]){

	// check number of arguments
	if (argc < 4){ //TODO maybe exceptions??
		cerr << "Error: Usage: <type> input_file output_file\n" <<
				"type is one of: cs, ci, cn, sn (n is replaced by the number)" <<endl;
		exit(1);
	}

	Operation* op = createOperation(argc, argv);

	//check if can do approximation for remaining time
	op->estimateRemainingTime();

	op->operate();


	return 0;
}


// compile from ~/CMS2_Project/CSM2/trunk/src:
//g++ -Wall Operations/Operation.cpp Operations/C_Operation.cpp orMain.cpp -o orTest
